import request from "@/utils/request";
import { uaaUrl } from "@/utils/request";

// 查询数据源
export function findDatasourceListPage(query) {
    return request({
      url: uaaUrl() + "/api-gen/v1/datasource/findDatasourceListPage",
      method: "get",
      params: query,
    });
}

// 根据数据源id查询表
export function getTableList(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/getTableList",
    method: "get",
    params: query,
  });
}

// 根据数据源表名查询字段
export function getCloumnList(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/getCloumnList",
    method: "get",
    params: query,
  });
}

// 保存表信息
export function saveTableInfo(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/saveTableInfo",
    method: "post",
    data: query,
  });
}

// 修改表信息
export function updateTableInfo(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/updateTableInfo",
    method: "post",
    data: query,
  });
}

// 查询代码生成列表
export function codeList(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/list",
    method: "get",
    params: query,
  });
}

// 数据详情
export function tableInfo(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/tableInfo",
    method: "post",
    params: query,
  });
}

// 删除代码生成列表
export function deleteCode(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/"+query,
    method: "DELETE",
  });
}

// 生成代码
export function expertGenCode(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/genCode",
    method: "get",
    params: query,
  });
}

// 表单  查询字段
export function mainTabcolumnList(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/mainTabcolumnList",
    method: "get",
    params: query,
  });
}

// 表单  修改字段属性
export function updateColumn(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/updateColumn",
    method: "post",
    data: query,
  });
}

//  获取字典项列表
export function sysDictTypeListPage(query) {
  return request({
    url: uaaUrl() + "/api-system/v1/sysDictType/sysDictTypeListPage",
    method: "get",
    params: query,
  });
}


// 查询条件 保存
export function genTableSearchColumn(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/genTableSearchColumn",
    method: "post",
    data: query,
  });
}

// 查询条件 获取
export function genTableSearchColumnList(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/genTableSearchColumn/genTableSearchColumnList",
    method: "get",
    params: query,
  });
}

// 按钮设置 保存
export function genTableButtons(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/genTableButtons",
    method: "post",
    data: query,
  });
}

// 按钮设置 获取
export function genTableButtonsListPage(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/genTableButtons/genTableButtonsListPage",
    method: "get",
    params: query,
  });
}

// 自定义查询列表-获取
export function findGenTableShowColumnList(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/genTableShowColumn/findGenTableShowColumnList",
    method: "get",
    params: query,
  });
}

// 自定义查询列表 保存
export function genTableShowColumn(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/genTableShowColumn",
    method: "post",
    data: query,
  });
}

// 分页组件 保存
export function savePages(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/genTablePages/savePages",
    method: "post",
    data: query,
  });
}

// 分页组件-获取
export function genTableByMainId(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/genTablePages/genTableByMainId",
    method: "get",
    params: query,
  });
}

// 保存其他信息 保存
export function saveOthers(query) {
  return request({
    url: uaaUrl() + "/api-gen/v1/gen/saveOthers",
    method: "post",
    data: query,
  });
}
